<?php

namespace app\meizhuangapi\controller;

use app\api\controller\Cart as CartCon;

/**
 * 购物车管理
 * Class Cart
 * @package app\api\controller
 */
class Cart extends CartCon
{
    /**
     * 加入购物车
     */
    public function addMz($goods_id, $goods_num, $goods_sku_id)
    {
        if (!$this->model->addMz($goods_id, $goods_num, $goods_sku_id)) {
            return $this->renderError($this->model->getError() ?: '加入购物车失败');
        }
        // 购物车商品总数量
        $totalNum = $this->model->getGoodsNum();
        return $this->renderSuccess(['cart_total_num' => $totalNum], '加入购物车成功');
    }
}
